using ETask.Api.Models;

namespace ETask.Api.Dtos
{
    /// <summary>
    /// 审计日志DTO
    /// </summary>
    public class AuditLogDto : BaseDto
    {
        /// <summary>
        /// 操作类型
        /// </summary>
        public string? ActionType { get; set; } = string.Empty;

        /// <summary>
        /// 操作模块
        /// </summary>
        public string? Module { get; set; } = string.Empty;

        /// <summary>
        /// 操作描述
        /// </summary>
        public string? Description { get; set; } = string.Empty;

        /// <summary>
        /// 操作者用户ID
        /// </summary>
        public int UserId { get; set; }

        /// <summary>
        /// 操作者用户名
        /// </summary>
        public string ? UserName { get; set; } = string.Empty;

        /// <summary>
        /// 操作者真实姓名
        /// </summary>
        public string ? Account { get; set; } = string.Empty;

        /// <summary>
        /// 目标对象ID
        /// </summary>
        public int? TargetId { get; set; }

        /// <summary>
        /// 目标对象名称
        /// </summary>
        public string ? TargetName { get; set; } = string.Empty;

        /// <summary>
        /// 操作前的数据
        /// </summary>
        public string? OldValues { get; set; }

        /// <summary>
        /// 操作后的数据
        /// </summary>
        public string? NewValues { get; set; }

        /// <summary>
        /// 客户端IP地址
        /// </summary>
        public string? ClientIp { get; set; }

        /// <summary>
        /// 用户代理
        /// </summary>
        public string? UserAgent { get; set; }

        /// <summary>
        /// 操作结果
        /// </summary>
        public string ? Result { get; set; } = "成功";

        /// <summary>
        /// 错误信息
        /// </summary>
        public string? ErrorMessage { get; set; }

        /// <summary>
        /// 操作时间
        /// </summary>
        public DateTime ActionTime { get; set; }
    }

    /// <summary>
    /// 审计日志查询参数
    /// </summary>
    public class AuditLogQueryParams
    {
        /// <summary>
        /// 操作类型
        /// </summary>
        public string? ActionType { get; set; }

        /// <summary>
        /// 操作模块
        /// </summary>
        public string? Module { get; set; }

        /// <summary>
        /// 关键词搜索（搜索描述、用户名、目标名称等）
        /// </summary>
        public string? Keyword { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime? StartTime { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime? EndTime { get; set; }

        /// <summary>
        /// 操作者用户ID
        /// </summary>
        public int? UserId { get; set; }

        /// <summary>
        /// 操作结果
        /// </summary>
        public string? Result { get; set; }

        public PaginationParameters PageDto { get; set; }
    }

    /// <summary>
    /// 创建审计日志DTO
    /// </summary>
    public class CreateAuditLogDto
    {
        /// <summary>
        /// 操作类型
        /// </summary>
        public string ActionType { get; set; } = string.Empty;

        /// <summary>
        /// 操作模块
        /// </summary>
        public string? Module { get; set; } = string.Empty;

        /// <summary>
        /// 操作描述
        /// </summary>
        public string ? Description { get; set; } = string.Empty;

        /// <summary>
        /// 目标对象ID
        /// </summary>
        public int? TargetId { get; set; }

        /// <summary>
        /// 目标对象名称
        /// </summary>
        public string ? TargetName { get; set; } = string.Empty;

        /// <summary>
        /// 操作前的数据
        /// </summary>
        public string? OldValues { get; set; }

        /// <summary>
        /// 操作后的数据
        /// </summary>
        public string? NewValues { get; set; }

        /// <summary>
        /// 操作结果
        /// </summary>
        public string ? Result { get; set; } = "成功";

        /// <summary>
        /// 错误信息
        /// </summary>
        public string? ErrorMessage { get; set; }
    }

    public class UpdateAuditLogDto
    {

    }
}
